<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
    <div class="row">
    	<div class="col-sm-12 search-collapse">
				<form id="proMem-form">
					<input id="proId" name="proId" th:field="${proInfo.proId}"  type="hidden">
					<div class="select-list">
						<ul>
							<li>
								项目名称：<input type="text" id="proName" name="proId" th:value="${proInfo.proName}" readonly="readonly"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="toAddHtml()" shiro:hasPermission="pm:proMem:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="pm:proMem:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="pm:proMem:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('pm:proMem:detail')}]];
        var wlDatas = [[${@dict.getType('pm_emp_level')}]];
        var isDatas = [[${@dict.getType('pm_yes_no')}]];
        var staDatas = [[${@dict.getType('pm_emp_status')}]];
        var prefix = ctx + "pm/proMem";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add/{id}",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                detailUrl: prefix + "/detail/{id}",
                modalName: "项目在场人员",
                queryParams: queryParams,
                uniqueId:"memId",
                search:false,
                showSearch:false,
                showColumns:false,
                showToggle:false,
                showExport:false,
                showRefresh:false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'memId', 
					title : '主键',
					visible: false
				},
				{
					field : 'proId', 
					title : '项目主键',
					visible: false
				},
				{
					field : 'empId', 
					title : '证件号码' 
				},
				{
					field : 'empNm', 
					title : '姓名' 
				},
				{
					field : 'wlLevel', 
					title : '人员级别',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(wlDatas, value);
		            }
				},
				{
					field : 'memIsNl', 
					title : '是否在人员名单内',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(isDatas, value);
		            }
				},
				{
					field : 'memStat', 
					title : '状态',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(staDatas, value);
		            }
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="#" onclick="$.operate.detail(\'' + row.memId + '\')"><i class="fa fa-search"></i>详细</a> ');
		            	return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
        function queryParams(params) {
			return {
				proId:          $("input[name='proId']").val(),
				pageSize:       params.limit,
    			pageNum:        params.offset/params.limit + 1,
    			searchValue:    params.search,
    			orderByColumn:  params.sort,
    			isAsc:          params.order
			};
		}
        
        function toAddHtml(){
      	  $.operate.add($("input[name='proId']").val());
        }
    </script>
</body>
</html>